;; Test a trivial recursive type works properly

;; RUN: wasm-opt %s -all -S -o - | filecheck %s

;; CHECK:      (module
;; CHECK-NEXT:   (type $ref?|...0|_=>_ref?|...0| (func (param (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|))))
;; CHECK-NEXT:   (func $foo (param $0 (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|))
;; CHECK-NEXT:     (unreachable)
;; CHECK-NEXT:   )
;; CHECK-NEXT:   (func $bar (param $0 (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|))
;; CHECK-NEXT:     (unreachable)
;; CHECK-NEXT:   )
;; CHECK-NEXT:   (func $baz (param $0 (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|))
;; CHECK-NEXT:     (unreachable)
;; CHECK-NEXT:   )
;; CHECK-NEXT:   (func $qux (param $0 (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|))
;; CHECK-NEXT:     (unreachable)
;; CHECK-NEXT:   )
;; CHECK-NEXT:   (func $quux (param $0 (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|))
;; CHECK-NEXT:     (unreachable)
;; CHECK-NEXT:   )
;; CHECK-NEXT: )

(module
  (type (func (param (ref null 0)) (result (ref null 0))))
  (type (func (param (ref null 1)) (result (ref null 1))))
  (type (func (param (ref null 0)) (result (ref null 1))))
  (type (func (param (ref null 3)) (result (ref null 4))))
  (type (func (param (ref null 4)) (result (ref null 3))))
  (func $foo (type 0)
    (unreachable)
  )
  (func $bar (type 1)
    (unreachable)
  )
  (func $baz (type 2)
    (unreachable)
  )
  (func $qux (type 3)
    (unreachable)
  )
  (func $quux (type 4)
    (unreachable)
  )
)
